package website.lucaswork.survey.mvc.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import website.lucaswork.survey.core.dtos.UserDTO;
import website.lucaswork.survey.core.services.UserService;
import website.lucaswork.survey.core.utils.DefaultValues;


@Controller
@RequestMapping("/user")
public class UserController extends SurveyWCI {
	@Autowired
    UserService userService;

	@Autowired
	DefaultValues defaultValues;
	
	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public String userlist(@PageableDefault Pageable pageable, Model model) {
	    Page<UserDTO> users = userService.getPageUsers(pageable);
	    model.addAttribute("users", users);
		return "/user/list";
	}
}
